home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / util / dtype / aiff_dtc.lha / source / asyncio.h < prev    next >
C/C++ Source or Header  |  1995-01-12  |  3KB  |  84 lines

  1. #ifndef __ASYNCIO_H
  2. #define __ASYNCIO_H
  3.  
  4.  
  5. /*****************************************************************************/
  6.  
  7.  
  8. #ifndef EXEC_TYPES_H
  9. #include <exec/types.h>
  10. #endif
  11.  
  12. #ifndef EXEC_PORTS_H
  13. #include <exec/ports.h>
  14. #endif
  15.  
  16. #ifndef DOS_DOS_H
  17. #include <dos/dos.h>
  18. #endif
  19.  
  20.  
  21. /*****************************************************************************/
  22.  
  23.  
  24. /* This structure is public only by necessity, don't muck with it yourself, or
  25.  * you're looking for trouble
  26.  */
  27. typedef struct AsyncFile
  28. {
  29.     BPTR                  af_File;
  30.     ULONG                 af_BlockSize;
  31.     struct MsgPort       *af_Handler;
  32.     APTR                  af_Offset;
  33.     LONG                  af_BytesLeft;
  34.     ULONG                 af_BufferSize;
  35.     APTR                  af_Buffers[2];
  36.     struct StandardPacket af_Packet;
  37.     struct MsgPort        af_PacketPort;
  38.     ULONG                 af_CurrentBuf;
  39.     ULONG                 af_SeekOffset;
  40.     UBYTE                 af_PacketPending;
  41.     UBYTE                 af_ReadMode;
  42.     UBYTE                 af_CloseFH;
  43.     UBYTE                 af_Pad;
  44.     struct ExecBase      *af_SysBase;
  45.     struct DosLibrary    *af_DOSBase;
  46. } AsyncFile;
  47.  
  48.  
  49. /*****************************************************************************/
  50.  
  51.  
  52. typedef enum OpenModes
  53. {
  54.     MODE_READ,      /* read an existing file                             */
  55.     MODE_WRITE,     /* create a new file, delete existing file if needed */
  56.     MODE_APPEND     /* append to end of existing file, or create new     */
  57. } OpenModes;
  58.  
  59. typedef enum SeekModes
  60. {
  61.     MODE_START = -1,   /* relative to start of file         */
  62.     MODE_CURRENT,      /* relative to current file position */
  63.     MODE_END           /* relative to end of file           */
  64. } SeekModes;
  65.  
  66.  
  67. /*****************************************************************************/
  68.  
  69.  
  70. AsyncFile *OpenAsyncFromFH(BPTR handle, OpenModes mode, LONG bufferSize, struct ExecBase *SysBase, struct DosLibrary *DOSBase);
  71. AsyncFile *OpenAsync(const STRPTR fileName, OpenModes mode, LONG bufferSize, struct ExecBase *SysBase, struct DosLibrary *DOSBase);
  72. LONG CloseAsync(AsyncFile *file);
  73. LONG ReadAsync(AsyncFile *file, APTR buffer, LONG numBytes);
  74. LONG ReadCharAsync(AsyncFile *file);
  75. LONG WriteAsync(AsyncFile *file, APTR buffer, LONG numBytes);
  76. LONG WriteCharAsync(AsyncFile *file, UBYTE ch);
  77. LONG SeekAsync(AsyncFile *file, LONG position, SeekModes mode);
  78.  
  79.  
  80. /*****************************************************************************/
  81.  
  82.  
  83. #endif /* __ASYNCIO_H */
  84.